﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;

namespace Domain.Adapters
{
	public class RemoteRegistry
	{
		readonly string _server;

		public RemoteRegistry(string server)
		{
			this._server = server;
		}
		public IEnumerable<string> GetIisComponents()
		{
			var rKey =
				RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, _server).OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").
					OpenSubKey("InetStp").OpenSubKey("Components");
			return rKey.GetValueNames().Where(x => rKey.GetValue(x).ToString() == "1").OrderBy(x => x);
		}
		public string Server
		{
			get
			{
				return this._server;
			}
		}
	}
}
